package cn.edu.zust.se.controller;

import cn.edu.zust.se.model.vo.UserVo;
import cn.edu.zust.se.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @description: TODO
 * @author: czg
 * @date: 2024/5/15 9:43
 */
@Controller
@RequestMapping("hello")
public class HelloController {
    @RequestMapping("hi")
    public String hi(String name){
        System.out.println("name="+name);
        return "hello";
    }
    @RequestMapping("aaaa")
    public String aaaa(){
        return "hello";
    }
    @RequestMapping(value = "login",method = RequestMethod.GET)
    public String loginPage(){
        return "login";
    }
    @RequestMapping(value = "login",method = RequestMethod.POST)
    public String doLogin(UserVo user){
        UserService service=new UserService();
        boolean b=service.login(user);
        if(b)
            return "home";
        else
            return "error";
    }
}
